FILES=libbncsutil.so libStorm.so ghost++

all: bncsutil/src/bncsutil/libbncsutil.so StormLib/stormlib/libStorm.so src/ghost++

bncsutil/src/bncsutil/libbncsutil.so: ${wildcard bncsutil/src/bncsutil/*.h bncsutil/src/bncsutil/*.cpp bncsutil/src/bncsutil/*.c}
	(cd bncsutil/src/bncsutil && make);
	@touch $@

grun/libbncsutil.so: bncsutil/src/bncsutil/libbncsutil.so
	cp -f $< $@

StormLib/stormlib/libStorm.so: ${wildcard StormLib/stormlib/*.h StormLib/stormlib/*.cpp StormLib/stormlib/*.c StormLib/stormlib/*/*.h StormLib/stormlib/*/*.cpp StormLib/stormlib/*/*.c}
	(cd StormLib/stormlib && make);
	@touch $@

grun/libStorm.so: StormLib/stormlib/libStorm.so
	cp -f $< $@

src/ghost++: ${wildcard src/*.h src/*.cpp src/*.c}
	(cd src && make);
	@touch $@

grun/ghost++: src/ghost++
	cp -f $< $@

install: ${patsubst %,grun/%,$(FILES)}

clean:
	@echo " CLEAN  bncsutil/src/bncsutil"
	@(cd bncsutil/src/bncsutil && make -s clean);
	@echo " CLEAN  StormLib/stormlib"
	@(cd StormLib/stormlib && make -s clean);
	@echo " CLEAN  src"
	@(cd src && make -s clean);
